package com.example.healthcondition.entity;

import java.time.LocalDateTime;

public class DietRecords {
    private Integer record_id;
    private Integer user_id;
    private String food_item;
    private Integer calories;
    private String serving_size;
    private String meal_type;
    private LocalDateTime recorded_at;

    // 默认构造函数
    public DietRecords() {
    }

    // 带所有属性的构造函数
    public DietRecords(Integer record_id, Integer user_id, String food_item, Integer calories, String serving_size, String meal_type, LocalDateTime recorded_at) {
        this.record_id = record_id;
        this.user_id = user_id;
        this.food_item = food_item;
        this.calories = calories;
        this.serving_size = serving_size;
        this.meal_type = meal_type;
        this.recorded_at = recorded_at;
    }

    // Getter和Setter方法
    public Integer getRecordId() {
        return record_id;
    }

    public void setRecordId(Integer record_id) {
        this.record_id = record_id;
    }

    public Integer getUserId() {
        return user_id;
    }

    public void setUserId(Integer user_id) {
        this.user_id = user_id;
    }

    public String getFoodItem() {
        return food_item;
    }

    public void setFoodItem(String food_item) {
        this.food_item = food_item;
    }

    public Integer getCalories() {
        return calories;
    }

    public void setCalories(Integer calories) {
        this.calories = calories;
    }

    public String getServingSize() {
        return serving_size;
    }

    public void setServingSize(String serving_size) {
        this.serving_size = serving_size;
    }

    public String getMealType() {
        return meal_type;
    }

    public void setMealType(String meal_type) {
        this.meal_type = meal_type;
    }

    public LocalDateTime getRecordedAt() {
        return recorded_at;
    }

    public void setRecordedAt(LocalDateTime recorded_at) {
        this.recorded_at = recorded_at;
    }

    // toString方法
    @Override
    public String toString() {
        return "DietRecords{" +
                "record_id=" + record_id +
                ", user_id=" + user_id +
                ", food_item='" + food_item + '\'' +
                ", calories=" + calories +
                ", serving_size='" + serving_size + '\'' +
                ", meal_type='" + meal_type + '\'' +
                ", recorded_at=" + recorded_at +
                '}';
    }

    // hashCode和equals方法
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        DietRecords that = (DietRecords) o;
        return record_id != null && record_id.equals(that.record_id);
    }

    @Override
    public int hashCode() {
        return record_id != null ? record_id.hashCode() : 0;
    }
}